package org.wdcode.core.lucene.index;

import org.wdcode.core.factory.BaseKeyFactory;
import org.wdcode.core.lucene.need.LuceneNeed;
import org.wdcode.core.lucene.need.SimpleLuceneNeed;

/**
 * Lucene索引工厂
 * @author WD
 * @since JDK6
 * @version 1.0 2010-04-25
 */
public final class LuceneIndexFactory extends BaseKeyFactory<LuceneNeed, LuceneIndex> {
	// 工厂
	private final static LuceneIndexFactory	FACTORY;
	// 静态初始化
	static {
		FACTORY = new LuceneIndexFactory();
	}

	/**
	 * 私有构造
	 */
	private LuceneIndexFactory() {
		super();
	}

	/**
	 * 获得工厂
	 * @return 工厂
	 */
	public final static LuceneIndexFactory getFactory() {
		return FACTORY;
	}

	/**
	 * 实例一个新的索引写入器
	 * @return LuceneIndex
	 */
	public final LuceneIndex newInstance() {
		return newInstance(new SimpleLuceneNeed());
	}

	/**
	 * 实例一个新的索引写入器
	 * @param need 构建Lucene所用类
	 * @return LuceneIndex
	 */
	public final LuceneIndex newInstance(LuceneNeed need) {
		return new LuceneIndexImpl(need);
	}
}